package com.eastfair.projectcore.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 接口与菜单关系
 * </p>
 *
 * @author ligang
 * @since 2023-05-11
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("c_interface_menu")
@ApiModel(value = "InterfaceMenu", description = "接口与菜单关系")
@AllArgsConstructor
public class InterfaceMenu extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 菜单ID
     */
    @ApiModelProperty(value = "菜单ID")
    @NotNull(message = "请填写菜单ID")
    @TableField(value = "menu_id")
    @Excel(name = "菜单ID")
    private Long menuId;

    /**
     * 方法名
     */
    @ApiModelProperty(value = "方法名")
    @Size(max = 255, message = "方法名长度不能超过255")
    @TableField(value = "method", condition = LIKE)
    @Excel(name = "方法名")
    private String method;

    /**
     * 替换完成地址
     */
    @ApiModelProperty(value = "替换完成地址")
    @Size(max = 255, message = "替换完成地址长度不能超过255")
    @TableField(value = "replace_full_url", condition = LIKE)
    @Excel(name = "替换完成地址")
    private String replaceFullUrl;

    /**
     * 全接口地址
     */
    @ApiModelProperty(value = "全接口地址")
    @Size(max = 255, message = "全接口地址长度不能超过255")
    @TableField(value = "full_url", condition = LIKE)
    @Excel(name = "全接口地址")
    private String fullUrl;

    /**
     * 接口ID
     */
    @ApiModelProperty(value = "接口ID")
    @NotNull(message = "请填写接口ID")
    @TableField(value = "interface_id")
    @Excel(name = "接口ID")
    private Long interfaceId;

    /**
     * 是否生效(默认1：可用 0:不可用)
     */
    @ApiModelProperty(value = "是否生效(默认1：可用 0:不可用)")
    @TableField(value = "is_enabled")
    @Excel(name = "是否生效(默认1：可用 0:不可用)")
    private Integer isEnabled;

    /**
     * 是否删除(默认0：未删除 1:已删除)
     */
    @ApiModelProperty(value = "是否删除(默认0：未删除 1:已删除)")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除(默认0：未删除 1:已删除)")
    private Integer isDeleted;


    @Builder
    public InterfaceMenu(Long id, LocalDateTime createTime, Long createdBy, LocalDateTime updateTime, Long updatedBy, 
                    Long menuId, String method, String replaceFullUrl, String fullUrl, Long interfaceId, 
                    Integer isEnabled, Integer isDeleted) {
        this.id = id;
        this.createTime = createTime;
        this.createdBy = createdBy;
        this.updateTime = updateTime;
        this.updatedBy = updatedBy;
        this.menuId = menuId;
        this.method = method;
        this.replaceFullUrl = replaceFullUrl;
        this.fullUrl = fullUrl;
        this.interfaceId = interfaceId;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
    }

}
